<?php
	class thongbaodata
	{
		public function Them($MaThongBao = "", $NgayTao = "",$NoiDung="",$TieuDe="",$TrangThai="")
		{
			$sql = "INSERT INTO thongbao(thongbao_ma, thongbao_ngaytao, thongbao_noidung, thongbao_tieude, thongbao_trangthai)
					VALUES('$MaThongBao', '$NgayTao', '$NoiDung', '$TieuDe', '$TrangThai' )";
			
			$service = new dataservice();
			return $service->ExecuteNonQuery($sql);
		}
		
		public function CapNhat($MaThongBao = "", $NgayTao = "",$NoiDung="",$TieuDe="",$TrangThai="")
		{			
			$sql= "UPDATE `thongbao` SET `thongbao_tieude`='$TieuDe',`thongbao_noidung`='$NoiDung',`thongbao_trangthai`='$TrangThai',`thongbao_ngaytao`='$NgayTao' WHERE `thongbao_ma`='$MaThongBao'";
			$service = new dataservice();
			return $service->ExecuteNonQuery($sql);
		}
		
		public function Xoa($MaThongBao = "")
		{
			$sql = "DELETE  FROM thongbao WHERE thongbao_ma = '$MaThongBao'";
			
			$service = new dataservice();
			return $service->ExecuteNonQuery($sql);
		}
		
		public function LayDanhSach($MaThongBao = "")
		{
			$sql = "SELECT * FROM thongbao WHERE 1";
			
			if($MaThongBao != "")
				$sql .= " AND thongbao_ma = '$MaThongBao'";
			
			$service = new dataservice();
			return $service->ExecuteQuery($sql);
		}
	}
?>